<?php


namespace App\Services;

/**
 * Class Code
 * @package App
 * author:fhc
 * desc:返回值的定义
 * created_at: 2020/10/16{
 */
class Code
{
    /**
     * author:fhc
     * desc:返回值
     * created_at: 2020/10/16{
     * @param string $msg
     * @param int $code
     * @param array $data
     * @return array
     */
    public static function message($msg = '提交成功',$code = 200,$data =[]){

        return [
            'code'=>$code,
            'msg'=>$msg,
            'data'=>(empty($data) || $data == null || $data == 'null') && $data !== 0 ? [] : $data
        ];
    }
}
